@echo off
:: =================================
::	OneKeyAuto 2024-10-28
::	7z Shortcut OfficeProPlus2019
::
:: =================================

rem ====	基本系統設定 set 一定要加""避免空白
set "Driver=%~d0"
set "FilePath=%~p0"
set "ConfFile=%~n0"
set "FullPath=%~dp0"
set "FullPathFile=%~f0"

title %~nx0

rem ====----	IsAdmin
call :IsAdmin

cd /D "%Driver%%FilePath%"
rem ==--

::	2024-09-03

if not exist "%ProgramFiles%\7-Zip\7z.exe" (
	cd  App\
	call download.cmd ini\7-zip.ini all c
	cd ..
) else (
	echo.File exist "%ProgramFiles%\7-Zip\7z.exe"
)

if not exist "%SystemDrive%\PortableApps\Shortcut\Shortcut.exe" (
	cd Portable\
	call download.cmd ini\ShortCut.ini all c
	call download.cmd ini\Shortcut_cmd.ini all c
	call Shortcut\MakeShortcut.bat c
	cd ..
) else (
	echo.File exist "%SystemDrive%\PortableApps\Shortcut\Shortcut.exe"
)

::
if exist OfficeProPlus2019 (
	echo	OfficeProPlus2019
	cd OfficeProPlus2019\
	call DownloadOfficeCmd.bat ini all c auto
	call RunSetupOffice2019.bat c auto
	rem call OfficeActivateLnk.bat c auto
	cd ..
)

goto End

:IsAdmin
	reg.exe query "HKU\S-1-5-19\Environment" >nul
	if not %ERRORLEVEL% EQU 0 (
		echo 必須「以系統管理員身分執行」
		echo You must have administrator rights to continue ...
		pause & exit
	)
	exit /b

:End
	cd /D "%Driver%%FilePath%"
	%ComSpec% /k